<?php 
$button_params = array 
(
	'0' => array 
	(	
		'title' => 'Button1',
		'href' => '?',
		'onclick' => 'submit();',
		'params' => array
		(
			'id' => 'openbutton',
			'type' => $item['type'],
		),
	),
	'1' => array 
	(	
		'title' => 'Button2',
		'href' => '?',
		'onclick' => 'submit();',
		'params' => array
		(
			'class' => 'active',
			'id' => 'Button2_id',
			'type' => $item['type'],
		),
	),
);

?>
<div style=" position:absolute; top:140px; right:20px; width:300px; padding:0px;">
	<?php echo getBorderHTML('', 'top', 1); ?>
	<div class="module">
    	<?php 
		echo getHeaderHTML(18, $button_params, 'Text&nbsp;', 'Text2&nbsp;', 'Text3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;', '', '');
		?> 
        <div class="module_content">
        <?php print_r($item);  ?>&nbsp;
        </div>
        <?php 
		echo getFooterHTML($item['id'], $button_params, 'Text&nbsp;', 'Text2&nbsp;', 'Text3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;', '', $footer['button']);
		?> 
    </div>
    <?php echo getBorderHTML('', 'bottom', 1); ?>
</div>

<?php
	if($item['l_image'] != '')
	{ $size_l = getimagesize(FOOTERS_PATH.$item['l_image']); }
	else
	{ 
		$size_l[0] = 0;
		$size_l[1] = 0;
	}
	if($item['r_image'] != '')
	{ $size_r = getimagesize(FOOTERS_PATH.$item['r_image']); }
	else
	{ 
		$size_r[0] = 0;
		$size_r[1] = 0;
	}
	?>
	<div class="com_footer">
		<div class="cf_<?php echo $item['id']; ?>">
			<?php if($item['l_image'] != ''):?>
			<div class="cf_left">
			<?php endif; ?>
				<?php if($item['r_image'] != ''): ?>
				<div class="cf_right">
				<?php endif; ?>
					<div class="cf_center">
						<div class="cf_content">
							<?php if($item['icon'] > 0): 
							$iconset = getIconSet($item['icon']);
							?>
							<span class="cf_icon"><img src="images/system/icon_spacer.gif" alt="" style="width:<?php echo $iconset['width']; ?>px; height:<?php echo $iconset['height']; ?>px;" /></span>
							<?php endif; ?>
							<h2 class="cf_txt">
							<?php if($item['imagefont'] == 1): echo getImageFont('Testing', 'Text', '', '', 0, 0); else: echo 'Item&nbsp;'; endif; ?>
							</h2>
							<h2 class="cf_txt2">Text 2&nbsp;</h2>
							<h2 class="cf_txt3">Text 3&nbsp;</h2>
							<?php if($item['button'] > 0): ?>
							<span class="cf_buttons"><?php // echo addButton($item['button'], 'Footer Button', '', 'edit_form.submit();', '', '', '', 1); ?></span>
							<?php endif; ?>
						</div>
					</div>
				<?php if($item['r_image'] != ''): ?>
				</div>
				<?php endif; ?>
			<?php if($item['l_image'] != ''): ?>
			</div>
			<?php endif; ?>
		</div>
	</div>
	
	
<input type="hidden" name="action" value="editor" />
<input type="hidden" name="item" value="<?php echo $item['id']; ?>" />
<fieldset style="clear:both;">
	<dl>
		<dt>Name:</dt>
		<dd>
			<input name="name" type="text" value="<?php echo $item['name']; ?>" style="width:30%">
			&nbsp;<?php echo $NameStatus; ?>
			<input type="submit" value="Save" style="padding-left:20px; padding-right:10px;  background-image: url('../images/system/save.gif'); border:1px solid #DDDDDD; height:20px;" class="buttons">
		</dd>
	</dl>
	<dl>
		<dt>Height:</dt>
		<dd>
			<select name="height">
				<?php 
					$i=1;
					while($i <= 200)
					{
						if ($i == $item['height'])
						{
							echo '<option value="'.$i.'" selected>'.$i.' px</option>';
						}
						else
						{
							echo '<option value="'.$i.'">'.$i.' px</option>';
						}
						$i ++;
					}
				?>
			</select>
		</dd>
	</dl>
	<dl>
		<dt>Image font:</dt>
		<dd>
			<select style="width:70px;" name="imagefont" onchange="submit();">
				<option value="0" <?php if ($item['imagefont'] == 0){echo 'selected'; }?>>No</option>
				<option value="1" <?php if ($item['imagefont'] == 1){echo 'selected'; }?>>Yes</option>
			</select>
		</dd>
	</dl>
	<dl>
		<dt>Left Image: <?php echo $item['l_image']; ?></dt>
		<dd>
			<input id="l_image" name="l_image" type="file" ></input>
			<?php 
				if($item['l_image'] != "")
				{
					$size = getimagesize(FOOTERS_PATH.$item['l_image']); 
					$fp = fopen(FOOTERS_PATH.$item['l_image'], "rb");
					if ($size && $fp) 
					{
						echo $size[0]." x ";
						echo $size[1]." px ";
					}
				}
				echo $lImageStatus;
			?>
			<?php if($item['l_image'] != "") { ?>
				<input type="checkbox" name="delete_l" value="1"><strong>(Delete Left)</strong>
			<?php } ?>
		</dd>
	</dl>
	<dl>
		<dt>Background Image: <?php echo $item['image']; ?></dt>
		<dd>
			<input id="image" name="image" type="file" value=""></input>
			<?php 
				if($item['image'] != "")
				{
					$size = getimagesize(FOOTERS_URL.$item['image']); 
					$fp = fopen(FOOTERS_PATH.$item['image'], "rb");
					if ($size && $fp) 
					{
						echo $size[0]." x ";
						echo $size[1]." px ";
						//echo $size[2];
						//echo $size[3];
					}
				}
				echo $ImageStatus;
			?>
			<?php if($item['image'] != "") { ?>
					<input type="checkbox" name="delete_bg" value="1"><strong>(Delete Background)</strong>
			<?php } ?>
		</dd>
	</dl>
	<dl>
		<dt>Background Image 2: <?php echo $item['image2']; ?></dt>
		<dd>
			<input id="image2" name="image2" type="file" value=""></input>
			<?php 
				if($item['image2'] != "")
				{
					$size = getimagesize(FOOTERS_URL.$item['image2']); 
					$fp = fopen(FOOTERS_PATH.$item['image2'], "rb");
					if ($size && $fp) 
					{
						echo $size[0]." x ";
						echo $size[1]." px ";
					}
				}
				echo $ImageStatus;
			?>
			<?php if($item['image2'] != "") { ?>
					<input type="checkbox" name="delete_bg2" value="1"><strong>(Delete Background 2)</strong>
			<?php } ?>
		</dd>
	</dl>
	<dl>
		<dt>Right Image: <?php echo $item['r_image']; ?></dt>
		<dd>
			<input id="r_image" name="r_image" type="file" value=""></input>
			<?php 
				if($item['r_image'] != "")
				{
					$size = getimagesize(FOOTERS_PATH.$item['r_image']); 
					$fp = fopen(FOOTERS_PATH.$item['r_image'], "rb");
					if ($size && $fp) 
					{
						echo $size[0]." x ";
						echo $size[1]." px ";
					}
				} 
				echo $rImageStatus;
			?>
			<?php if($item['r_image'] != "") { ?>
				<input type="checkbox" name="delete_r" value="1"><strong>(Delete Right)</strong>
			<?php } ?>
		</dd>
	</dl>
	<dl>
		<dt>Default Button:</dt>
		<dd>
			<select name="button" onchange="submit();">
				<option value="0">None</option>
				<?php 
				if($buttons)
				{
					foreach($buttons as $button)
					{
						if($item['button'] == $button['id'])
						{
							echo '<option value="'.$button['id'].'" selected="selected">'.$button['name'].'</option>';
						}
						else
						{
							echo '<option value="'.$button['id'].'" >'.$button['name'].'</option>';
						}
					}
				}
				?>
			</select>
		</dd>
	</dl>
	<dl>
		<dt>Default Icon Set:</dt>
		<dd>
			<select name="icon" onchange="submit();">
				<option value="0">None</option>
				<?php 
				if($iconsets)
				{
					foreach($iconsets as $iconset)
					{
						if($item['icon'] == $iconset['id'])
						{
							echo '<option value="'.$iconset['id'].'" selected="selected">'.$iconset['name'].'</option>';
						}
						else
						{
							echo '<option value="'.$iconset['id'].'" >'.$iconset['name'].'</option>';
						}
					}
				}
				?>
			</select>
		</dd>
	</dl>
	<dl>
		<dt>Edit Footer Style</dt>
		<dd>&nbsp;</dd>
	</dl>
	</fieldset>
	<table cellpadding="0" cellspacing="0" border="1" style="cursor:pointer; width:100%; background-color:#EEEEEE; height:30px;">
		<tr>
			<?php if($item['l_image'] != ''): ?>
			<td id="board_1" rowspan="4" onclick="setVisible('cf_left'); toggleClassName(this.id, 'board_active');" align="center" style="width:60px; border-right:1px solid #CCCCCC;">Left Bg Image</td>
			<?php endif; ?>
			<td id="board_2" colspan="5" onclick="setVisible('cf_center'); toggleClassName(this.id, 'board_active');" align="center">Center Area (header bg and height)</td>
			<?php if($item['r_image'] != ''): ?>
			<td id="board_3" rowspan="4" onclick="setVisible('cf_right'); toggleClassName(this.id, 'board_active');" align="center" style="width:60px; border-left:1px solid #CCCCCC;">Right Bg Image</td>
			<?php endif; ?>
		</tr>
		<tr>
			<td id="board_4" rowspan="2" align="center" onclick="setVisible('cf_icon'); toggleClassName(this.id, 'board_active');">Icon Area </td>
			<td id="board_10" colspan="3" align="center" onclick="setVisible('h2'); toggleClassName(this.id, 'board_active');" style="border-right:1px solid #CCCCCC;">Text Areas</td>
			<td id="board_8" rowspan="2" align="center" onclick="setVisible('cf_buttons'); toggleClassName(this.id, 'board_active');">Button Area</td>
		</tr>
		<tr>
			<td id="board_5" align="center" onclick="setVisible('cf_txt'); toggleClassName(this.id, 'board_active');" style="border-right:1px solid #CCCCCC;">Text 1 Area</td>
			<td id="board_6" align="center" onclick="setVisible('cf_txt2'); toggleClassName(this.id, 'board_active');" style="border-right:1px solid #CCCCCC;">Text 2 Area</td>
			<td id="board_7" align="center" onclick="setVisible('cf_txt3'); toggleClassName(this.id, 'board_active');" style="border-right:1px solid #CCCCCC;">Text 3 Area</td>
		</tr>
		<tr>
			<td id="board_9" colspan="5" onclick="setVisible('cf_content'); toggleClassName(this.id, 'board_active');" align="center">Content Area (Container of text icons and buttons)</td>
		</tr>
	</table>
	<fieldset>
    <?php 
	$style['cf'] = getStyleCss(2, $item['id'], 'div.com_footer div.cf_'.$item['id'].'');
	if($style['cf'] == '')
	{ $style['cf'] = '';}
	?>
    <dl>
		<dt>div.com_footer div.cf_<?php echo $item['id']; ?></dt>
		<dd>
			<textarea name="cf" style="width:50%; height:60px;"><?php echo $style['cf']; ?></textarea>
		</dd>
	</dl>
	<?php 
	if($item['l_image'] != ''):
	$style['cf_left'] = getStyleCss(2, $item['id'], 'div.com_footer div.cf_'.$item['id'].' div.cf_left');
	if($style['cf_left'] == '')
	{ $style['cf_left'] = 'padding-left:'.$size_l[0].'px; background-image:url(images/'.$item['l_image'].');';}
	?>
	<dl id="cf_left" style="display:none;">
		<dt>div.com_footer div.cf_<?php echo $item['id']; ?> div.cf_left</dt>
		<dd>
			<textarea name="cf_left" style="width:50%; height:120px;"><?php echo $style['cf_left']; ?></textarea>
		</dd>
	</dl>
	<?php endif; ?>
	<?php 
	if($item['r_image'] != ''):
	$style['cf_right'] = getStyleCss(2, $item['id'], 'div.com_footer div.cf_'.$item['id'].' div.cf_right');
	if($style['cf_right'] == '')
	{ $style['cf_right'] = 'padding-right:'.$size_r[0].'px; background-image:url(images/'.$item['r_image'].');';}
	?>
	<dl id="cf_right" style="display:none;">
		<dt>div.com_footer div.cf_<?php echo $item['id']; ?> div.cf_right</dt>
		<dd>
			<textarea name="cf_right" style="width:50%; height:120px;"><?php echo $style['cf_right']; ?></textarea>
		</dd>
	</dl>
	<?php endif; ?>
	<?php 
	$style['cf_center'] = getStyleCss(2, $item['id'], 'div.com_footer div.cf_'.$item['id'].' div.cf_center');
	if($style['cf_center'] == '')
	{ $style['cf_center'] = 'height:'.$item['height'].'px; background-image:url(images/'.$item['image'].');';}
	?>
	<dl id="cf_center" style="display:none;">
		<dt>div.com_footer div.cf_<?php echo $item['id']; ?> div.cf_center</dt>
		<dd>
			<textarea name="cf_center" style="width:50%; height:120px;"><?php echo $style['cf_center']; ?></textarea>
		</dd>
	</dl>
	<?php 
	$style['cf_content'] = getStyleCss(1, $item['id'], 'div.com_footer div.cf_'.$item['id'].' div.cf_content');
	if(($style['cf_content'] == '') && ($item['image2'] != ''))
	{ $style['cf_content'] = 'height:'.$item['height'].'px; background-image:url(images/'.$item['image2'].'); background-repeat:no-repeat;';}
	?>
	<dl id="cf_content" style="display:none;">
		<dt>div.com_footer div.cf_<?php echo $item['id']; ?> div.cf_content</dt>
		<dd>
			<textarea name="cf_content" style="width:50%; height:120px;"><?php echo $style['cf_content']; ?></textarea>
		</dd>
	</dl>
	<?php 
	$style['cf_icon'] = getStyleCss(1, $item['id'], 'div.com_footer div.cf_'.$item['id'].' .cf_icon');
	if($style['cf_icon'] == '')
	{ $style['cf_icon'] = 'float:left;';}
	?>
	<dl id="cf_icon" style="display:none;">
		<dt>div.com_footer div.cf_<?php echo $item['id']; ?> .cf_icon</dt>
		<dd>
			<textarea name="cf_icon" style="width:50%; height:120px;"><?php echo $style['cf_icon']; ?></textarea>
		</dd>
	</dl>
	<?php 
	$style['h2'] = getStyleCss(2, $item['id'], 'div.com_footer div.cf_'.$item['id'].' h2');
	if($style['h2'] == '')
	{ $style['h2'] = 'float:left;';}
	?>
	<dl id="h2" style="display:none;">
		<dt>div.com_footer div.cf_<?php echo $item['id']; ?> h2</dt>
		<dd>
			<textarea name="h2" style="width:50%; height:120px;"><?php echo $style['h2']; ?></textarea>
		</dd>
	</dl>
	<?php 
	$style['cf_txt'] = getStyleCss(2, $item['id'], 'div.com_footer div.cf_'.$item['id'].' .cf_txt');
	if($style['cf_txt'] == '')
	{ $style['cf_txt'] = 'float:left;';}
	?>
	<dl id="cf_txt" style="display:none;">
		<dt>div.com_footer div.cf_<?php echo $item['id']; ?> .cf_txt</dt>
		<dd>
			<textarea name="cf_txt" style="width:50%; height:120px;"><?php echo $style['cf_txt']; ?></textarea>
		</dd>
	</dl>
	<?php 
	$style['cf_txt2'] = getStyleCss(2, $item['id'], 'div.com_footer div.cf_'.$item['id'].' .cf_txt2');
	if($style['cf_txt2'] == '')
	{ $style['cf_txt2'] = 'float:left;';}
	?>
	<dl id="cf_txt2" style="display:none;">
		<dt>div.com_footer div.cf_<?php echo $item['id']; ?> .cf_txt2</dt>
		<dd>
			<textarea name="cf_txt2" style="width:50%; height:120px;"><?php echo $style['cf_txt2']; ?></textarea>
		</dd>
	</dl>
	<?php 
	$style['cf_txt3'] = getStyleCss(2, $item['id'], 'div.com_footer div.cf_'.$item['id'].' .cf_txt3');
	if($style['cf_txt3'] == '')
	{ $style['cf_txt3'] = 'float:left;';}
	?>
	<dl id="cf_txt3" style="display:none;">
		<dt>div.com_footer div.cf_<?php echo $item['id']; ?> .cf_txt3</dt>
		<dd>
			<textarea name="cf_txt3" style="width:50%; height:120px;"><?php echo $style['cf_txt3']; ?></textarea>
		</dd>
	</dl>
	<?php 
	$style['cf_buttons'] = getStyleCss(2, $item['id'], 'div.com_footer div.cf_'.$item['id'].' .cf_buttons');
	if($style['cf_buttons'] == '')
	{ $style['cf_buttons'] = 'float:right;';}
	?>
	<dl id="cf_buttons" style="display:none;">
		<dt>div.com_footer div.cf_<?php echo $item['id']; ?> .cf_buttons</dt>
		<dd>
			<textarea name="cf_buttons" style="width:50%; height:120px;"><?php echo $style['cf_buttons']; ?></textarea>
		</dd>
	</dl>
	<dl>
		<dt>Footer Categories:</dt>
		<dd>
			<select size="10" name="hfb_cats" style="width:20%;">
				<?php 
				if($hfbcats)
				{
					foreach($hfbcats as $hfbcat)
					{
						echo '<option ondblclick="edit_form.add_to_cat.value=this.value; edit_form.submit();" value="'.$hfbcat['id'].'">'.$hfbcat['title'].'</option>';
					}
				}
				?>
			</select>
			<select size="10" name="hfb_in_cats" style="width:20%;">
				<?php 
				if($incats)
				{
					foreach($incats as $incat)
					{
						echo '<option ondblclick="edit_form.rem_from_cat.value=this.value; edit_form.submit();" value="'.$incat['id'].'">'.$incat['title'].'</option>';
					}
				}
				?>
			</select>
			<input type="hidden" id="add_to_cat" name="add_to_cat" value="0" />
			<input type="hidden" id="rem_from_cat" name="rem_from_cat" value="0" />
		</dd>
	</dl>
</fieldset>